﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using FrienDev.Data;
using FrienDev.BusinessRules;

/// <summary>
/// Summary description for CheckNewMessageService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class CheckNewMessageService : System.Web.Services.WebService
{

    public CheckNewMessageService()
    {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod(EnableSession = true)]
    public int CheckNewMsg()
    {
        if (UserRules.Instance.IsCurrentUserLogined)
        {
            int m_ShortMsgCount = MessageRules.Instance.GetCurrentUserMessageCount();
            int m_SystemMsgCount = MessageRules.Instance.GetCurrentUserSystemMessageCount();
            int m_TotalCount = m_SystemMsgCount + m_ShortMsgCount;
            return m_TotalCount;
        }
        else
        {
            return 0;
        }
    }

}

